package com.thx.workfloworguser.dao;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.springframework.stereotype.Repository;

import com.thx.org.model.Department;
import com.thx.user.model.User;

@Repository
public class DepartmentImplDao {

	public Department getMajorDepOfUser(String userId) {
		Department department = new Department();
		department.setDepId("dept001");
		department.setDepName("研发部");
		return department;
	}

	public List<Department> getAllDepsAndUsers(String comId) {
		return getDeptList();
	}

	public List<Department> getDepsOfUser(String userId) {
		return getDeptList();
	}

	public static List<Department> getDeptList() {
		List<Department> list = new ArrayList<Department>();
		Set<User> set1 = new HashSet<User>();
		Department dept1 = new Department();
		dept1.setDepId("dept001");
		dept1.setDepName("研发部");
		User u1 = new User();
		u1.setUserId("user00101");
		u1.setUserName("zhangshan");
		User u2 = new User();
		u2.setUserId("user00102");
		u2.setUserName("lisi");
		set1.add(u1);
		set1.add(u2);
		dept1.setUsers(set1);
		list.add(dept1);


		Set<User> set2 = new HashSet<User>();
		Department dept2 = new Department();
		dept2.setDepId("dept002");
		dept2.setDepName("行业事业部");
		User u3 = new User();
		u3.setUserId("user00201");
		u3.setUserName("wangwu");
		User u4 = new User();
		u4.setUserId("user00202");
		u4.setUserName("maliu");
		set2.add(u3);
		set2.add(u4);
		dept2.setUsers(set2);
		list.add(dept2);

		return list;
	}

}
